<template>
  <div>
    <!-- 轮播图区 -->
    <mt-swipe :auto="4000">
      <mt-swipe-item v-for="(item,index) in sewiptList" :key="item.id">
        <img :src="item.img" alt />
      </mt-swipe-item>
    </mt-swipe>

    <!-- 九宫格的改造工程 -->
    <div class="mui-content">
      <ul class="mui-table-view mui-grid-view mui-grid-9">
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <router-link to="/home/newLsit">
            <img src="../../assets/img/menu1.png" alt />
            <div class="mui-media-body">新闻资讯</div>
          </router-link>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <a href="#">
            <img src="../../assets/img/menu2.png" alt />
            <div class="mui-media-body">商品购买</div>
          </a>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <a href="#">
            <img src="../../assets/img/menu3.png" alt />
            <div class="mui-media-body">图文分享</div>
          </a>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <a href="#">
            <img src="../../assets/img/menu4.png" alt />
            <div class="mui-media-body">视频专区</div>
          </a>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <a href="#">
            <img src="../../assets/img/menu5.png" alt />
            <div class="mui-media-body">联系我们</div>
          </a>
        </li>
        <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
          <a href="#">
            <img src="../../assets/img/menu6.png" alt />
            <div class="mui-media-body">留言反馈</div>
          </a>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { Toast } from "mint-ui";
export default {
  data() {
    return {
      sewiptList: []
    };
  },
  created() {
    this.$axios
      .get("/bannerList")
      .then(data => {
        this.sewiptList = data.data;
        // console.log(data);
      })
      .catch(error => {
        Toast("加载轮播图数据失败！");
      });
  }
};
</script>

<style lang="less" scoped >
.mint-swipe {
  background: pink;
  height: 200px;
  img {
    width: 100%;
    height: 100%;
  }
}
.mui-media-body {
  font-size: 18px;
}
.mui-grid-view.mui-grid-9 {
  background: #fff;
  img {
    width: 100%;
    height: 100%;
  }
}
//页面的切换动画
.v-enter {
  opacity: 0;
  transform: translateX(100%);
}

.v-leave-to {
  opacity: 0;
  transform: translateX(-100%);
  position: absolute;
}
.v-enter-active,
.v-leave-active {
  transition: all 0.5s ease;
}
</style>
